//
//  MD2Anim.m
//  CompGraf2
//
//  Created by Juan Niosi on 30/09/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MD2Anim.h"

@implementation MD2Anim
@synthesize name, frames;

- (id)init
{
    self = [super init];
    if (self) {
        name = @"";
        frames = [[NSArray alloc] init];
    }
    
    return self;
}

- (id)initWithName:(NSString *)animName withFrames:(NSArray *)animFrames
{
    self = [super init];
    if (self) {
        self.name = animName;
        self.frames = animFrames;
    }
    
    return self;
}

- (int)countFrames
{
    return [frames count];
}

- (MD2AnimFrame *)getFrame:(int)idx
{
    if (idx < 0 || idx >= [frames count])
        return nil;
    
    return [frames objectAtIndex:idx];
}

- (void)dealloc
{
    free(name);
    free(frames);
    [super release];
}
@end
